#ifndef _GAMMA_DLL_H_
#define _GAMMA_DLL_H_

#include <stdio.h> 
#include <stdlib.h> 
#include "usb_device.h"
#include "usbd_cdc.h"
#include <ctype.h>	

extern double L_X,L_Y,L_Z;
extern double CASDK_LUM,CASDK_X,CASDK_Y;
extern bool CASDK_Busy;
//--------------------------------------

extern int Red_Ratio;
extern int Green_Ratio;
extern int Blue_Ratio;
//--------------系数----------------------------------------------------
extern int Last_reg_red;
extern int Last_reg_green;
extern int Last_reg_blue;
//--------------多组计算------------------------------------------------
extern int flexible_gamma_point_list[80]; //存储灰阶
extern int flexible_gamma_reg_red[80];    //存储每阶R寄存器
extern int flexible_gamma_reg_green[80];  //存储每阶G寄存器
extern int flexible_gamma_reg_blue[80];   //存储每阶B寄存器
extern int flexible_gamma_reg_count;
//--------------单段计算------------------------------------------------
extern int Past_Reg_stack[3][250];  //存储每跳步R/G/B寄存器值
extern int Past_lum_stack[3][250];    //存储每跳步R/G/B分亮度值   
extern double BCompare0[250];
//--------------单点加速------------------------------------------------
extern bool Register_jump_flag;  
extern bool Register_lum_jump_flag;
extern bool Gamma_adjust_timeout_flag;
extern int Gamma_auto_adjust_count;
extern int Gamma_auto_adjust_count_temp;
//extern int Gamma_auto_adjust_count_set;
//--------------单色加速-------------------------------------------------
extern int Y_adjust_count;
extern int X_adjust_count;
//-----------------------------------------------------------------------
extern int Steph,Stepm,Stepl;
//-----------------------------------------------------------------------
extern int Output_reg_red; 
extern int Output_reg_green; 
extern int Output_reg_blue; 
extern bool timeout_flag;	


extern void EE_Design_Key0(USBD_HandleTypeDef *pdev);
extern void EE_Design_Key1(USBD_HandleTypeDef *pdev);


extern void Lvxy_to_XYZ(double l_Lv, double l_x, double l_y);
extern bool Flexible_Gamma_auto_Adujst(int lum_adjust_enable, int x_adjust_enable, int y_adjust_enable, 
									   double measure_lum, double measure_x, double measure_y,
									   double target_lum, double target_x, double target_y, 
									   int input_reg_red, int input_reg_green, int input_reg_blue,
									   int gary_target, int reg_range,int Gamma_auto_adjust_count_set);


#endif